﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;

namespace ERPStore.Offers.Repositories.Mapping
{
	public class OfferMap : EntityTypeConfiguration<Datas.OfferData>
	{
		public OfferMap()
		{
			this.HasKey(t => t.Id);
			Property(e => e.Id)
				.IsRequired()
				.HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);

			Property(e => e.CSSTag)
				.HasMaxLength(20)
				.IsOptional();

			Property(e => e.Description)
				.IsMaxLength()
				.IsOptional();

			Property(e => e.EndDate)
				.IsOptional();

			Property(e => e.Link)
				.HasMaxLength(255)
				.IsRequired();

			Property(e => e.Name)
				.HasMaxLength(50)
				.IsRequired();

			Property(e => e.StartDate)
				.IsOptional();

			Property(e => e.Title)
				.IsRequired()
				.HasMaxLength(255);

			Property(e => e.ViewName)
				.HasMaxLength(50)
				.IsOptional();

			Property(e => e.ProductViewName)
				.HasMaxLength(50)
				.IsOptional();

			ToTable("dbo.ERPStoreOffersOffer");
		}
	}
}
